/**
 * 
 */
package org.stars.dao.exception;

import java.io.Serializable;

/**
 * Eccezione generica per il package daoStars.
 * 
 * @author Francesco Benincasa (908099)
 *
 */
public class DaoException extends RuntimeException implements Serializable {
	
	public DaoException(String msg, Exception e) {

		super(msg);			
				
		if (e!=null)
		{
			rootCause=e;
		} else {
			rootCause=new Exception(msg);		
		}
	}
	
	public DaoException(Exception e)
	{
		this(e.getMessage(), e);
	}
	
	public DaoException(String msg)
	{
		this(msg, new Exception(msg));
	}
		

	
	/**
	 * serial id
	 */
	private static final long serialVersionUID = -4748865983567779175L;
	
	/**
	 * exception root
	 */
	protected Exception rootCause;
	
	
	/**
	 * getter of the rootCause
	 * 
	 * @return
	 * 		rootCause or <code>null</code>
	 */
	public Exception getRootCause()
	{
		return rootCause;
	}
	
	/**
	 * setter of the rootCause
	 * 
	 * @param e
	 * 		value
	 * 			
	 */
	public void setRootCause(Exception e)
	{
		rootCause=e;
	}



}
